# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgbase=mtr
pkgname=('mtr' 'mtr-gtk')
pkgver=0.92
pkgrel=1
pkgdesc='Combines the functionality of traceroute and ping into one tool'
url='http://www.bitwizard.nl/mtr/'
arch=('i686' 'x86_64')
license=('GPL2')
makedepends=('ncurses' 'gtk2' 'libcap')
install=mtr.install
source=(${pkgbase}-${pkgver}.tar.gz::ftp://ftp.bitwizard.nl/mtr/${pkgbase}-${pkgver}.tar.gz)
sha512sums=('d362a418b6c17fd2d08da1ed9e033fa3330e4c0497e1bb0644f6193d23f4e20dd8ee181942c2a20ec0025a8b96c521394a21be5a1d9036f8a0a8c4cddfbe381f')

prepare() {
  (cd ${pkgbase}-${pkgver}
    autoreconf -fiv
  )
  cp -ra ${pkgbase}-${pkgver}{,-cli}
}

build() {
  (cd ${pkgbase}-${pkgver}-cli
    ./configure --prefix=/usr --without-gtk --sbindir=/usr/bin
    make
  )
  (cd ${pkgbase}-${pkgver}
    ./configure --prefix=/usr --sbindir=/usr/bin
    make
  )
}

package_mtr() {
  pkgdesc='Combines the functionality of traceroute and ping into one tool (CLI version)'
  depends=('ncurses' 'libcap')
  optdepends=('bash-completion: bash completion support')
  cd ${pkgbase}-${pkgver}-cli
  make DESTDIR="${pkgdir}" install
}

package_mtr-gtk() {
  pkgdesc='Combines the functionality of traceroute and ping into one tool (GTK version)'
  depends=('ncurses' 'libcap' 'gtk2')
  optdepends=('bash-completion: bash completion support')
  conflicts=('mtr')
  provides=("mtr=${pkgver}")
  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
}

# vim: ts=2 sw=2 et:
